package com.teen9g.infoplatformserver.controller;

import com.teen9g.infoplatformserver.HttpEntity.DeepseekClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@RestController
@RequestMapping("/api")
public class DeepseekController {

    @Autowired
    private DeepseekClient deepseekClient;

    @PostMapping("/ask")
    public String askQuestion(String prompt) {
        try {
            return deepseekClient.callDeepSeek(prompt);
        } catch (IOException e) {
            e.printStackTrace();
            return "Error calling DeepSeek API";
        }
    }
}
